home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / tnos / tnos100s / mailbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-23  |  7.6 KB  |  184 lines

  1. #ifndef _MAILBOX_H
  2. #define _MAILBOX_H
  3. /* Defines for the ax.25 mailbox facility */
  4. #define NUMMBX        40        /* max number of mailbox sessions */
  5. #ifndef _TIMER_H
  6. #include "timer.h"
  7. #endif
  8. #ifndef _AX25_h
  9. #include "ax25.h"
  10. #endif
  11. #ifndef _CONFIG_H
  12. #include "config.h"
  13. #endif
  14. #ifndef _TIPMAIL_H
  15. #include "tipmail.h"
  16. #endif
  17.  
  18. /* a mailbox entry */
  19. struct let {
  20.     long    start;
  21.     long    size;
  22.     long    bid;
  23.     int    status;
  24. };
  25.  
  26. #define MAXPWDLEN 30
  27. #define MBXLINE     128     /* max length of line */
  28. struct mbx {
  29.     int state ;                /* mailbox state */
  30. #define MBX_LOGIN    0        /* trying to log in */
  31. #define MBX_CMD        1        /* in command mode */
  32. #define MBX_SUBJ    2        /* waiting for a subject line */
  33. #define MBX_DATA    3        /* collecting the message */
  34. #define MBX_REVFWD    4        /* reverse forwarding in progress */
  35. #define MBX_TRYING    5        /* pending forwarding connection */
  36. #define MBX_FORWARD    6        /* established forwarding connection */
  37. #define MBX_GATEWAY 7       /* gatewaying somewhere */
  38. #define MBX_READ    8       /* reading a message */
  39. #define MBX_UPLOAD  9       /* uploading a file */
  40. #define MBX_DOWNLOAD 10     /* downloading a file */
  41. #define MBX_CONVERS 11      /* Using convers mode */
  42. #define MBX_CHAT    12      /* Chatting with sysop */
  43. #define MBX_WHAT    13      /* Listing files */
  44. #define MBX_SYSOPTRY 14     /* Trying sysop */
  45. #define MBX_SYSOP   15      /* Is sysop */
  46. #define MBX_XMODEM_RX 16    /* receiving xmodem */    
  47. #define MBX_XMODEM_TX 17    /* sending xmodem */
  48. #define MBX_TUTOR   18      /* using Tutorial server */
  49.     int family;             /* Type of incoming connection */
  50.     char name[20] ;         /* Name of remote station */
  51.     char call[AXALEN];      /* User call in shifted form, if applicable*/
  52.     char *to ;          /* To-address in form user or user@host */
  53.     char *origto ;            /* Original To-address, if rewritten */
  54.     char *tofrom ;            /* Optional <from in to-address */
  55.     char *origbbs ;         /* Original bbs, if tracing R: lines */
  56.     char *tomsgid ;         /* Optional $msgid in to-address */
  57.     char *subject ;         /* Message subject */
  58.     char *date ;            /* Date of the message */
  59.     FILE *tfile ;           /* Temporary file for message, or */
  60.                     /* forwarding file. */
  61.     FILE *tfp;              /* Temporary file when reading R: headers */
  62.     char line[MBXLINE+1] ;  /* Room for null at end */
  63.     int mbnum ;        /* which mailbox session is this? */
  64.     int sid ;        /* Characteristics indicated by the SID */
  65.                 /* banner of the attaching station.  If */
  66.                 /* no SID was sent, this is zero.  If an */
  67.                 /* SID of any kind was received, it is */
  68.                 /* assumed that the station supports */
  69.                 /* abbreviated mail forwarding mode. */
  70. #define    MBX_SID        0x01    /* Got any SID */
  71. #define    MBX_RLI_SID    0x02    /* This is an RLI BBS, disconnect after F> */
  72. #define MBX_HIER_SID    0x04    /* The BBS supports "hierarchical routing */
  73.                 /* designators." */
  74. #define MBX_FBB         0x08    /* This is an FBB BBS */
  75. #define MBX_FBBCOMP     0x10    /* This FBB supports compression */
  76. #define MBX_TNOS        0x20    /* supports TNOS Compressed streams */
  77. #define MBX_LL          0x40    /* LAN-LINK system */
  78.                 /* Space here for others, currently not of */
  79.                 /* interest to us. */
  80. #define MBX_EXPERT      0x80    /* expert user status */
  81. #define MBX_AREA        0x100    /* show area in prompt */
  82. #define MBX_NRID        0x200    /* use netrom ident */
  83. #define MBX_RDMOTD      0x400    /* has read motd file */
  84. #define MBX_STATS       0x800    /* scan for new messages on login ? */
  85. #define MBX_MID         0x1000    /* BBS supports MID's */
  86. #define MBX_GFX         0x2000    /* use ANSI color graphics */
  87.     char stype ;        /* BBS send command type (B,P,T, etc.) */
  88.     char special;        /* special mode flag for '~' and '^' */
  89.     int type ;        /* Type of session when invoking "chat" */
  90.     int user;        /* User linkage area */
  91.     char escape;        /* Escape character */
  92.     long privs;        /* Privileges (taken from Ftpusers file) */
  93. #define AX25_CMD    8    /* AX.25 gateway operation allowed */
  94. #define TELNET_CMD    16    /* Telnet gateway operation allowed */
  95. #define NETROM_CMD    32    /* NET/ROM gateway operation allowed */
  96. #define SYSOP_CMD    64    /* Remote sysop access allowed */
  97. #define EXCLUDED_CMD    128    /* This user is banned from the BBS */
  98. /* 256 and 512 are used in PPP*/
  99. #define NO_SENDCMD  1024    /*Disallow send command*/
  100. #define NO_READCMD  2048    /*Disallow read command*/
  101. #define NO_3PARTY   4096    /*Disallow third-party mail*/
  102. #define IS_BBS      8192    /*This user is a bbs*/
  103. #define IS_EXPERT    16384    /*This user is an expert*/
  104. #define NO_CONVERS  32768   /*Disallow convers command */
  105. #define NO_ESCAPE   65536   /* Default is no escape */
  106. #define NO_SLIP    131072    /* This user can't exit tipmail to do IP */
  107.     char *path;     /* Directory path */
  108.     char *startmsg;     /* Message to be sent at connect through any
  109.                 /* of the gateways */
  110.     int current;        /* the current message number */
  111.     int nmsgs;        /* number of messages in this mail box */
  112.     int newmsgs;        /* number of new messages in mail box */
  113.     int hmsgs;        /* number of held messages in this mail box */
  114.     int change;        /* mail file changed */
  115. #define CHG_READ    0x01
  116. #define CHG_DELETE    0x02
  117.     int anyread;        /* true if any message has been read */
  118.     FILE *mfile;        /* mail data file pointer */
  119.     char area[64];        /* name of current mail area */
  120.     int isarea;         /* is the current mail area private or public ? */
  121.     int morerows;       /* Number of lines before -more- prompt */
  122.     int update;         /* Update the user preferences */
  123. /* Next two are used by userlog code - WG7J */
  124.     long lastread;        /* number of last read message in area */
  125.     long newlastread;   /* id of new last listed message in area */
  126.     long mboxsize;        /* size of mailbox when opened */
  127.     long mysize;        /* size of my private mailbox */
  128.     struct let *mbox;
  129.     struct timer tdisc; /* Inactivity timeout timer - WG7J */
  130.     char *stdinbuf;        /* the stdio buffer for the mail file */
  131.     char *stdoutbuf;    /* the stdio file io buffer for the temp file */
  132.     char *home;        /* the HOME BBS for this user */
  133.     long logontime;        /* time of this login */
  134.     struct tipcb *tip;       /* tip structure if tip mail incoming */
  135.     char colorset[2];    /* current colorset */
  136.     char usecolor;        /* use color this login ? */
  137.     char inmessage;        /* are we in a message read/write? */
  138.     char *realname;        /* user's real name */
  139. } ;
  140. #define     NULLMBX        (struct mbx *)0
  141.  
  142. /* Structure used for automatic flushing of gateway sockets */
  143. struct gwalarm {
  144.     int s1;
  145.     int s2;
  146.     struct timer t;
  147. };
  148.  
  149. /* In mailbox.c */
  150. extern struct mbx *Mbox[NUMMBX] ;
  151. extern char Noperm[];
  152. extern char Nosock[];
  153. extern void (*Listusers) __ARGS((int s));
  154. extern int ThirdParty;
  155. extern int Mtrace;
  156.  
  157. int dombescape __ARGS((int argc,char *argv[],void *p));
  158. int mbxrecvline __ARGS((struct mbx *m));
  159. int gw_connect __ARGS((struct mbx *m,int s,struct sockaddr *fsocket,int len));
  160.  
  161. void mbx_incom __ARGS((int s,void *t,void *p));
  162. int domboxdisplay __ARGS((int argc,char *argv[],void *p));
  163. struct mbx *newmbx __ARGS((void));
  164. void exitbbs __ARGS((struct mbx *m));
  165. int domboxbye __ARGS((int argc,char *argv[],void *p));
  166. int mbx_parse __ARGS((struct mbx *m));
  167. void changearea __ARGS((struct mbx *m,char *area,int setit));
  168. char *rewrite_address __ARGS((char *addr));
  169. void listusers __ARGS((int s));
  170. void bbscolorcls __ARGS((struct mbx *m));
  171. void bbscolorchange __ARGS((struct mbx *m,unsigned char *str));
  172.  
  173.  
  174. /* In forward.c: */
  175. int dorevfwd __ARGS((int argc,char *argv[],void *p));
  176. int dombtimer __ARGS((int argc,char *argv[],void *p));
  177. int dombkick __ARGS((int argc,char *argv[],void *p));
  178.  
  179. /* In tipmail.c */
  180. extern unsigned Tiptimeout;
  181.  
  182. #endif    /* _MAILBOX_H */
  183.  
  184.